package cn.johnyu.order.client;

import cn.johnyu.commons.dto.AccountDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "account-service")
public interface AccountClient {
    @GetMapping("/info")
    String info();

    @GetMapping("accounts/{id}")
    AccountDto loadAccount(@PathVariable("id") int id);

    @PutMapping("/reduceBalance")
    int reduceBalance(@RequestParam("id") int id,@RequestParam("amount") int amount);
}
